// fix bootstrap-select

//
// Dropdown menus
// --------------------------------------------------

$fix-caret-width-base:          4px !default
$fix-dropdown-fallback-border:  #ccc !default
$fix-border-radius-base:        #ccc !default
$fix-border-radius-base:        4px !default
$fix-border-radius-large:       6px !default
$fix-border-radius-small:       3px !default
$fix-line-height-base:          1.428571429 !default
$fix-font-size-base:            14px
$fix-font-size-large:           ceil(($fix-font-size-base * 1.25))
$fix-font-size-small:           ceil(($fix-font-size-base * 0.85))
$fix-line-height-computed:      floor(($fix-font-size-base * $fix-line-height-base)) !default
$fix-screen-sm:                  768px
$fix-screen-sm-min:              $fix-screen-sm
$fix-screen-md:                 992px
$fix-screen-md-min:             $fix-screen-md
$fix-screen-sm-max:             ($fix-screen-md-min - 1)
$fix-grid-float-breakpoint:     $fix-screen-sm-min
$fix-zindex-dropdown:           1000
$fix-dropdown-bg:               #fff
$fix-dropdown-border:           rgba(0,0,0,.15)
$fix-dropdown-divider-bg:       #e5e5e5
$fix-dropdown-link-color:       $gray-dark
$fix-dropdown-link-hover-color: darken($gray-dark, 5%)
$fix-dropdown-link-hover-bg:    #f5f5f
$fix-dropdown-link-active-color:     $component-active-color
$fix-dropdown-link-active-bg:        $component-active-bg
$fix-dropdown-link-disabled-color:   $gray-light
$fix-cursor-disabled:                not-allowed
$fix-dropdown-header-color:          $gray-light
$fix-dropdown-caret-color:           #000


div.bootstrap-select
  width: 100% !important

// Dropdown arrow/caret
.dropdown_select .caret
  display: inline-block
  width: 0
  height: 0
  margin-left: 2px
  vertical-align: middle
  border-top: $fix-caret-width-base dashed
  border-top: $fix-caret-width-base solid \9
  // IE8
  border-right: $fix-caret-width-base solid transparent
  border-left: $fix-caret-width-base solid transparent

// The dropdown wrapper (div)

.dropdown_select .dropup
  position: relative

// Prevent the focus on the dropdown toggle when closing dropdowns
.dropdown_select .dropdown-toggle:focus
  outline: 0
.dropdown_select .dropdown-toggle::after
  display: none

// The dropdown menu (ul)
.dropdown_select .dropdown-menu
  position: absolute
  top: 100%
  left: 0
  z-index: $fix-zindex-dropdown
  display: none
  // none by default, but block on "open" of the menu
  float: left
  min-width: 160px
  padding: 5px 0
  margin: 2px 0 0
  // override default ul
  list-style: none
  font-size: $fix-font-size-base
  text-align: left
  // Ensures proper alignment if parent has it changed (e.g., modal footer)
  background-color: $fix-dropdown-bg
  border: 1px solid $fix-dropdown-fallback-border
  // IE8 fallback
  border: 1px solid $fix-dropdown-border
  border-radius: $fix-border-radius-base
  box-shadow: 0 6px 12px
  background-clip: padding-box
  // Aligns the dropdown menu to right
  //
  // Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`
  &.pull-right
    right: 0
    left: auto
  // Dividers (basically an hr) within the dropdown
  .divider
    height: 1px
    margin: (($fix-line-height-computed / 2) - 1) 0
    overflow: hidden
    background-color: $fix-dropdown-divider-bg
  // Links within the dropdown menu
  > li > a
    display: block
    padding: 3px 20px
    clear: both
    font-weight: normal
    line-height: $fix-line-height-base
    color: $fix-dropdown-link-color
    white-space: nowrap
    // prevent links from randomly breaking onto new lines

// Hover/Focus state
.dropdown_select .dropdown-menu > li > a
  &:hover,
  &:focus
    text-decoration: none
    color: $fix-dropdown-link-hover-color
    background-color: $fix-dropdown-link-hover-bg

// Active state
.dropdown_select .dropdown-menu > .active > a
  &,
  &:hover,
  &:focus
    color: $fix-dropdown-link-active-color
    text-decoration: none
    outline: 0
    background-color: $fix-dropdown-link-active-bg

// Disabled state
//
// Gray out text and ensure the hover/focus state remains gray

.dropdown_select .dropdown-menu > .disabled > a
  &,
  &:hover,
  &:focus
    color: $fix-dropdown-link-disabled-color
  // Nuke hover/focus effects
  &:hover,
  &:focus
    text-decoration: none
    background-color: transparent
    background-image: none
    // Remove CSS gradient
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false)
    cursor: $fix-cursor-disabled

// Open state for the dropdown
.dropdown_select .open
  // Show the menu
  > .dropdown-menu
    display: block
  // Remove the outline when :focus is triggered
  > a
    outline: 0

// Menu positioning
//
// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
// menu with the parent.
.dropdown_select .dropdown-menu-right
  left: auto
  // Reset the default from `.dropdown-menu`
  right: 0

// With v3, we enabled auto-flipping if you have a dropdown within a right
// aligned nav component. To enable the undoing of that, we provide an override
// to restore the default dropdown menu alignment.
//
// This is only for left-aligning a dropdown menu within a `.navbar-right` or
// `.pull-right` nav component.
.dropdown_select .dropdown-menu-left
  left: 0
  right: auto

// Dropdown section headers
.dropdown_select .dropdown-header
  display: block
  padding: 3px 20px
  font-size: $fix-font-size-small
  line-height: $fix-line-height-base
  color: $fix-dropdown-header-color
  white-space: nowrap
  // as with > li > a

// Backdrop to catch body clicks on mobile, etc.
.dropdown_select .dropdown-backdrop
  position: fixed
  left: 0
  right: 0
  bottom: 0
  top: 0
  z-index: $fix-zindex-dropdown - 10

// Right aligned dropdowns
.dropdown_select .pull-right > .dropdown-menu
  right: 0
  left: auto

// Allow for dropdowns to go bottom up (aka, dropup-menu)
//
// Just add .dropup after the standard .dropdown class and you're set, bro.
// TODO: abstract this so that the navbar fixed styles are not placed here?

.dropdown_select .dropup
  // Reverse the caret
  .caret
    border-top: 0
    border-bottom: $fix-caret-width-base dashed
    border-bottom: $fix-caret-width-base solid \9
    // IE8
    content: ""
  // Different positioning for bottom up menu
  .dropdown-menu
    top: auto
    bottom: 100%
    margin-bottom: 2px

// Component alignment
//
// Reiterate per navbar.less and the modified component alignment there.

@media (min-width: $fix-grid-float-breakpoint)
  .dropdown_select .navbar-right
    .dropdown-menu
      right: 0
      left: auto
    // Necessary for overrides of the default right aligned menu.
    // Will remove come v4 in all likelihood.
    .dropdown-menu-left
      left: 0
      right: auto

.dropdown_select
  .hidden
    display: none

